<?php

require_once "DbMysql.php";

$config = array(
			'host' => '127.0.0.1',
			'port' => '3306',
			'username' => 'root',
			// 'password' => 'root',
			'password' => 'YU0bty7A',
			'db' => 'lottery'
			);
$db = new DB($config);

$get = $_GET;

$code = $get['code'];

$condition = array('uniquestr' => $code);
$res = $db->select_one("verification_code", $condition);

$result = array();
if ($res) {
	if ($res['isget']) {
		if ($res['isverify']) {
			$result['status'] = 'error';
			$result['info'] = "抽奖码已失效！";
		} else {
			$result['status'] = 'success';
			$db->update("verification_code", array('isverify'=>1), $condition);
		}
	} else {
		$result['status'] = 'error';
		$result['info'] = '无效的抽奖码！';
	}
} else {
	$result['status'] = 'error';
	$result['info'] = '抽奖码不存在！';
}

$db->close();

echo json_encode($result);


?>